﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration;
using System.Configuration;

namespace FantastPlatform.Framework
{
    public sealed class ServiceFactory
    {
        public static T CreateService<T>()
        {
            UnityContainer container;
            container = new UnityContainer();
            UnityConfigurationSection section = (UnityConfigurationSection)ConfigurationManager.GetSection("serviceUnit");
            string containerName = "NHibernate";
            section.Containers[containerName].Configure(container);
            return container.Resolve<T>();
        }
    }
}
